package com.qk.ezbuy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qk.ezbuy.dao.UserMapper;
import com.qk.ezbuy.pojo.News;
import com.qk.ezbuy.pojo.User;
import com.qk.ezbuy.pojo.UserAddress;
import com.qk.ezbuy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Repository
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User selectByLoginName(String loginName) {
        return userMapper.selectByLoginName(loginName);
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public PageInfo<User> selectPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<User> list = userMapper.selectPage();
        PageInfo<User> pageInfo = new PageInfo<User>(list);
        return pageInfo;
    }

    @Override
    public int delUser(User user) {
        return userMapper.delUser(user);
    }

    @Override
    public User selectByID(int id) {
        return userMapper.selectByID(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

}
